/**
 * 
 */
package hanto.studentdlally;

import hanto.common.HantoGame;
import hanto.studentdlally.alpha.AlphaHantoGame;
import hanto.studentdlally.gamma.GammaHantoGame;
import hanto.studentdlally.delta.DeltaHantoGame;
import hanto.util.HantoGameID;

/**
 * Singleton factory for creating different types of HantoGames
 * @author Doug
 * @version 1
 */
public class HantoGameFactory {
	private static HantoGameFactory instance = null;
	
	/**
	 * Private constructor
	 */
	private HantoGameFactory(){
		
	}
	
	/**
	 * @return the instance of HantoGameFactory
	 */
	public static HantoGameFactory getInstance(){
		if(instance == null){
			instance = new HantoGameFactory();
		}
		return instance;
	}
	
	
	/**
	 * Factory method to create different versions of HantoGame
	 * @param id Type of HantoGame to create
	 * @return a HantoGame of the specified type, null if the specified type is unavailable
	 */
	public HantoGame makeHantoGame(HantoGameID id){
		if(id == HantoGameID.ALPHA_HANTO){
			return new AlphaHantoGame();
		}
		if(id == HantoGameID.GAMMA_HANTO){
			return new GammaHantoGame();
		}
		if(id == HantoGameID.DELTA_HANTO){
			return new DeltaHantoGame();
		}
		return null;
	}

}
